from django.contrib import admin
from sns.models import *

class ArticleAdmin(admin.ModelAdmin):
    list_display = ('id','title','user','category','date')
    list_filter = ('category',)
    search_fields = ['id','user__username','title']
admin.site.register(Article, ArticleAdmin)

class CategoryAdmin(admin.ModelAdmin):
    list_display = ('id','name','price')
admin.site.register(Category, CategoryAdmin)

class FriendsAdmin(admin.ModelAdmin):
    list_display = ('id','user','follower','date')
    search_fields = ['id','user__username']
admin.site.register(Friends, FriendsAdmin)

class UserProfileAdmin(admin.ModelAdmin):
    list_display = ('id','user','paypal')
    search_fields = ['id','user__username']
admin.site.register(UserProfile, UserProfileAdmin)

class CommentAdmin(admin.ModelAdmin):
    list_display = ('id','user','article','date')
    search_fields = ['id','user__username']
admin.site.register(Comment, CommentAdmin)

class DirectMessageAdmin(admin.ModelAdmin):
    list_display = ('id','from_user','to_user','date')
    search_fields = ['id','from_user__username','to_user__username']
admin.site.register(DirectMessage, DirectMessageAdmin)

class PaypalFilterAdmin(admin.ModelAdmin):
    list_display = ('id','name')
    search_fields = ['name']
admin.site.register(PaypalFilter,PaypalFilterAdmin)

class ContactAdmin(admin.ModelAdmin):
    list_display = ('title','name','email','content','file')
    search_fields = ['title','name','content','email']
admin.site.register(Contact,ContactAdmin)

class Vote_historyAdmin(admin.ModelAdmin):
    list_display = ('article_id','user_id','ticket')
admin.site.register(Vote_history,Vote_historyAdmin)

class Ad_Admin(admin.ModelAdmin):
    list_display = ('pay_user','pay_to_paypal','pre_date')
admin.site.register(Ad,Ad_Admin)

class BoardAdmin(admin.ModelAdmin):
    list_display = ('name','property','apply_date')
admin.site.register(Board,BoardAdmin)

class BoardFollowerAdmin(admin.ModelAdmin):
    list_display = ('board','user','apply_date')
admin.site.register(BoardFollower,BoardFollowerAdmin)

class ReportAdmin(admin.ModelAdmin):
    list_display = ('article_id','user','dm_id','date')
admin.site.register(Report,ReportAdmin)


class CategoryIntegralAdmin(admin.ModelAdmin):
    list_display = ('user','year','week','integral','category')
    list_filter = ('category',)
admin.site.register(CategoryIntegral,CategoryIntegralAdmin)